import React from 'react';
import * as asyncLoad from '../util/asyncLoad';
import { workflowPublicFiles } from '../constants/fileConfig';
import Loading from './Loading';

export default class ModifyLog extends React.Component{
    constructor(){
        super();
        this.state = {
            hasLoad: false,
            store: null
        };
    }
    componentDidMount(){
        const init = () =>{
            const { WfFormModifyLogStore } = window.weaWorkflowPublic;
            const store = new WfFormModifyLogStore();
            this.setState({hasLoad:true, store:store});
        }
        asyncLoad.asyncLoadModule('workflowPublic', workflowPublicFiles, init);
    }
    render(){
        const { hasLoad,store } = this.state;
        if(hasLoad){
            const { WfFormModifyLogCom } = window.weaWorkflowPublic;
            const { commonParam,closeFun,visible } = this.props;
            const { requestid,nodeid,f_weaver_belongto_userid,f_weaver_belongto_usertype,wfmonitor,intervenorright } = commonParam;
            store.appendBaseParams({requestid,nodeid,f_weaver_belongto_userid,f_weaver_belongto_usertype,ismonitor:wfmonitor?"1":"0",intervenorright}, visible);
            store.setCloseDialogFun(closeFun);
            return (
                <WfFormModifyLogCom ecId={`${this && this.props && this.props.ecId || ''}_WfFormModifyLogCom@x6lmn5`} wfFormModifyLogStore={store} />
            )
        }else{
            return (<Loading ecId={`${this && this.props && this.props.ecId || ''}_Loading@ghakby`} />);
        }
    }
}